package edu.demo.config.datasource;

import com.baymax.springboot.cli.aware.ProfileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author xiao.hu
 * @date 2021-08-07
 * @apiNote spring3.2 之后 @Profile注解用在 方法上
 */
@Component
public class DataSourceConfig implements IDataSourceConfig {

    @Autowired
    JdbcProperties jdbcProperties;

    @Override
    public void setup() {
        String activeProfile = ProfileUtil.getActiveProfile();
        System.out.println(String.format("Setting up dataSource for %s environment. ", activeProfile));
        System.out.println(String.format("url: %s \r\n user: %s", jdbcProperties.getUrl(), jdbcProperties.getUsername()));
    }
}
